home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 676-700 / 685 / publicmanager / publictools / setpubmodes.s < prev    next >
Text File  |  1995-03-18  |  3KB  |  146 lines

  1. ;    Setpubmode        put in the Public Domain
  2. ;    written in 1992 by Michael Watzl
  3. ;    
  4. ;    Syntax: Setpubmode -sx -px
  5. ;
  6. ;    -s SHANGHAI    
  7. ;    -p POPPUBSCREEN
  8. ;        x=0 deaktivates this mode
  9. ;        x=1 switches this mode on
  10. ;
  11. ;    this has been written for the devpac V2.16
  12. ;    Needs Kick 2! (Public screens)
  13.  
  14.  
  15. ; lazy includes
  16.  
  17. OpenLib        = -552
  18. CloseLib        = -414
  19. SetPubModes    = -546
  20. PutStr        = -948
  21.  
  22. TAB    = 09
  23. CR    = 10
  24.  
  25. ; MAIN
  26.  
  27. ******************************************
  28. **                **
  29. **          MAIN        **
  30. **                **
  31. ******************************************
  32.  
  33.     pea    (a0)        ; save the argument pointer
  34.     lea    DosName,a1    ; open the libs
  35.     move.l    4.w,a6
  36.     moveq    #36,d0        ; version
  37.     jsr    OpenLib(a6)    ; open dos.library
  38.     tst.l    d0
  39.     beq    quit
  40.     move.l    d0,_DosBase
  41.     lea    IntName,a1
  42.     move.l    4.w,a6
  43.     moveq    #36,d0        ; I think V36 should work
  44.     jsr    OpenLib(a6)
  45.     move.l    d0,_IntBase
  46.  
  47. ******************************************
  48. **                **
  49. **           Parse         **
  50. **                **
  51. ******************************************
  52.  
  53. Parse    moveq    #0,d0        ; Modes to d4.w
  54.     move.l    _IntBase,a6
  55.     jsr    SetPubModes(a6)
  56.     move.w    d0,d4
  57.     jsr    SetPubModes(a6)
  58.  
  59.     move.l    (sp)+,a0        ; fetch argument pointer
  60.     cmp.b    #CR,(a0)
  61.     beq    usage
  62.  
  63. loop    cmp.b    #" ",(a0)
  64.     beq.s    increase
  65.     cmp.b    #"-",(a0)
  66.     beq.s    foundopt
  67.     cmp.b    #CR,(a0)
  68.     beq.s    endofargs
  69.     bra.s    usage        none of the expected chars!
  70.  
  71. increase    adda.l    #1,a0
  72.     bra.s    loop
  73.  
  74. foundopt    adda.l    #1,a0
  75.     cmp.b    #"s",(a0)
  76.     beq.s    shang
  77.     cmp.b    #"S",(a0)
  78.     beq.s    shang
  79.     cmp.b    #"p",(a0)
  80.     beq.s    pop
  81.     cmp.b    #"P",(a0)
  82.     beq.s    pop
  83.     bra.s    usage
  84.  
  85. shang    adda    #01,a0
  86.     cmp.b    #"1",(a0)
  87.     beq.s    shang1
  88.     cmp.b    #"0",(a0)
  89.     beq.s    shang0
  90.     bra.s    usage
  91. shang1    bset    #0,d4        ; Set SHANGHAI
  92.     bra.s    increase
  93. shang0    bclr    #0,d4
  94.     bra.s    increase
  95. pop    adda    #1,a0
  96.     cmp.b    #"1",(a0)
  97.     beq.s    pop1
  98.     cmp.b    #"0",(a0)
  99.     beq.s    pop0
  100.     bra.s    usage
  101. pop1    bset    #1,d4        ; set POPPUBSCREEN    
  102.     bra.s    increase
  103. pop0    bclr    #1,d4
  104.     bra.s    increase
  105.  
  106. endofargs    move.w    d4,d0
  107.     move.l    _IntBase,a6
  108.     jsr    SetPubModes(a6)
  109.     bra.s    quit
  110.  
  111. usage    move.l    #usage.txt,d1
  112.     move.l    _DosBase,a6
  113.     jsr    PutStr(a6)
  114.  
  115. ******************************************
  116. **                **
  117. **                 QUIT        **
  118. **                **
  119. ******************************************
  120.  
  121. quit    move.l    4.w,a6
  122.     move.l    _DosBase,d0    if(DOSBase)
  123.     tst.l    d0
  124.     beq.s    next1
  125.     movea.l    d0,a1
  126.     jsr    CloseLib(a6)        Close
  127. next1    move.l    _IntBase,d0    if(IntuitionBase)
  128.     tst.l    d0
  129.     beq.s    next2
  130.     movea.l    d0,a1
  131.     jsr    CloseLib(a6)        Close
  132.     moveq    #0,d0
  133.     move.w    d4,d0        -> Modes as RC!
  134. next2    rts            "My only friend, the end" (Doors...)
  135.  
  136.  
  137. DosName    dc.b    "dos.library"        ; this order saves 2 bytes (Wow!)
  138. _DosBase    dc.l    0
  139. IntName   dc.b    "intuition.library"
  140. _IntBase    dc.l    0
  141.  
  142. usage.txt    dc.b    "Usage:",TAB,"SetPubModes    -sx -px",CR,TAB,TAB,"-s",TAB,"SHANGHAI",CR,TAB,TAB,"-p",TAB,"POPPUBSCREEN",CR,TAB,"x=0 deaktvate this mode",CR,TAB,"x=1 switch it on",CR
  143.     dc.b    "The return code tells you which mode is active...",CR
  144.     dc.b    27,"[32mWritten by Michael Watzl in 1992 (PD!)",27,"[31m",CR,0
  145.  
  146.